package org.zsl.service;

import org.springframework.stereotype.Service;
import org.zsl.model.ResponseMessage;
import org.zsl.model.User;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserService2 {

    public ResponseMessage login(User user) {


        ResponseMessage message = new ResponseMessage();

        if(user.getUsername().equals("admin")&&user.getPassword().equals("123")){

            message.setSuccess(true);
        }else {
            message.setSuccess(false);
        }

        return  message;

    }


    public List<User> getList(){

        List<User> list=new ArrayList<>();

        User user1 = new User();
        user1.setUsername("test1");
        user1.setPassword("123");

        User user2 = new User();
        user2.setUsername("test2");
        user2.setPassword("123");

        User user3 = new User();
        user3.setUsername("test3");
        user3.setPassword("123");

        list.add(user1);
        list.add(user2);
        list.add(user3);


        return  list;



    }


    public ResponseMessage editUser(User user) {

         if(user.getUserId()!=null){
             // 修改
         }else{
              //添加
         }

         return new  ResponseMessage();
    }

    public ResponseMessage removeUser(Integer userId) {

        return new  ResponseMessage();

    }

    public User getSingle(Integer userId) {

        return  new User();
    }
}
